package com.effvi.jdk.collection.list;

public class ListA {
	public static void main(String[] args) {
		String[] list = new String[10000000];
		for(int i=0;i<10000000;i++){
			list[0] = "fffff";
		}
		String[] list2 = new String[10000000];
		long s1 = System.currentTimeMillis();
		for(int i=0,len = list.length;i<len;i++){
			list2[i] = list[i];
		}
		long s2 = System.currentTimeMillis();
		
		String[] list3 = new String[10000000];
		long s3 = System.currentTimeMillis();
		System.arraycopy(list, 0, list3, 0, list.length);//System.arraycopy进行数组复制比较高效
		long s4 = System.currentTimeMillis();
		
		System.out.println("普通循环数组复制耗时: "+(s2-s1)+" ms");
		System.out.println("System.arraycopy数组复制耗时: "+(s4-s3)+" ms");
		//System.arraycopy(src, srcPos, dest, destPos, length);
	}
}